package com.mingqijia.gassafety.shared.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 1:民用,2:商用,3:工业,4:公福,5:工商 7:分销商
 */
@Getter
@RequiredArgsConstructor
public enum CustTypeEnum {

    CUST_TYPE_1("1", "民用"),
    CUST_TYPE_2("2", "商用"),
    CUST_TYPE_3("3", "工业"),
    CUST_TYPE_4("4", "公福"),
    CUST_TYPE_5("5", "工商"),
    CUST_TYPE_7("7", "分销商");

    private final String custTypeCode;
    private final String custType;

    /**
     * @Method getCustType
     * @Author zm
     * @Description getCustType
     * @Date 2024/8/15 14:57
    */
    public static String getCustType(String custType) {
        if (custType == null) {
            return null;
        }
        for (CustTypeEnum typeEnum : CustTypeEnum.values()) {
            if (typeEnum.custTypeCode.equals(custType)) {
                return typeEnum.custType;
            }
        }
        return "商用";
    }
    /**
     * @Method toMap
     * @Author zm
     * @Description toMap
     * @Date 2024/8/15 14:54
    */
    public static Map<String, String> toMap() {
        Map<String, String> map = new HashMap<>();
        for (CustTypeEnum typeEnum : CustTypeEnum.values()) {
            map.put(typeEnum.getCustTypeCode(), typeEnum.getCustType());
        }
        return map;
    }
}